/*
 * @lc app=leetcode.cn id=392 lang=typescript
 *
 * [392] 判断子序列
 */

// @lc code=start
function isSubsequence(s: string, t: string): boolean {
    if (s === "") return true;

    let target = 0;
    let now = 0;
    while (now < t.length) {
        const it = t[now];
        if (s[target] === it) {
            target++;
        }
        if (target >= s.length) return true;
        now++;
    }
    return false;
}
// @lc code=end
